NotBlankString
@Serializable(with = NotBlankStringSerializer::class)
@Since(version = KotoolsTypesVersion.V4_0_0)
Represents a string that has at least one character excluding whitespaces.
You can use the toNotBlankString function for creating an instance of this type.
Serialization and deserialization
The serialization and deserialization processes of this type behave like for the String type.
Here's an example of Kotlin code that encodes and decodes this type using the JavaScript Object Notation (JSON) format from kotlinx.serialization:
val string: NotBlankString = "hello world".toNotBlankString()
.getOrThrow()
val encoded: String = Json.encodeToString(string)
println(encoded) // "hello world"
val decoded: NotBlankString = Json.decodeFromString(encoded)
println(decoded == string) // true
Content copied to clipboard
Types
Link copied to clipboard
object Companion
Contains static declarations for the NotBlankString type.
Functions
Link copied to clipboard
@Since(version = KotoolsTypesVersion.V4_1_0)
Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
Concatenates this string with the string representation of the other object.